#include "ThreadPool.hpp"
// #include "ThreadPool_singleton.hpp"
#include "Task.hpp"
#include <memory>
#include <time.h>

int main()
{
    srand(time(nullptr));
    Console();

    std::unique_ptr<ThreadPool<Task>> tp = std::make_unique<ThreadPool<Task>>();
    tp->Start();

    int cnt = 10;
    while(cnt--)
    {
        int x = rand()%10 +1;
        usleep(rand()%61);
        int y = rand()%7 +1;

        Task t(x, y);
        tp->Push(t);
        // ThreadPool<Task>::GetInstance()->Push(t);//单例线程池

        sleep(1);
    }

    tp->Stop();
    tp->Wait();

    // ThreadPool<Task>::GetInstance()->Stop();
    // ThreadPool<Task>::GetInstance()->Wait();
    

    return 0;
}